import {
	get,
	post,
	formData
} from './axios';

/**
 * 登录的接口
 */

export const login = (username, password) => get('weChatApi/login/login', {
	username,
	password
});


/**
 * 这是首页用户的接口，也是我的页面查询接口
 */

export const getMineList = (clientId, phone) => get('weChatApi/fgclient/getMineList', {
	clientId,
	phone
});


/**
 * 首页获取申请付款数量的接口
 */

export const getPayList = clientId => get('weChatApi/fgclient/getPayList', {
	clientId
})


/**
 * 提交付款
 */

export const applyMoney = id => get("weChatApi/fgclient/applyMoney", {
	id
})


/**
 * 首页获取待办数量的接口,也是订单列表查询数据接口
 */

export const getOrderList = (clientId, pageNumber, pageSize) => get('api/order/getOrderList', {
	clientId,
	pageNumber,
	pageSize
})


/**
 * 订单详情查询接口
 */

export const getFgOrderDetail = orderId => get("api/order/getFgOrderDetail", {
	orderId
})


/**
 * 显示报价单
 */

export const getOffer = (clientId, orderNo) => get("weChatApi/fgclient/getOffer", {
	clientId,
	orderNo
})


/**
 * 上传报价单的接口
 */

export const uploadOfferSheet = formDate => formData("weChatApi/fgclient/uploadOfferSheet", formDate)


/**
 * 签章合同查询
 */

export const getSignContract = (clientId, orderNo) => get("weChatApi/fgclient/getSignContract", {
	clientId,
	orderNo
})


/**
 * 签章合同上传图片
 */

export const uploadClientSignContract = formDate => formData('weChatApi/fgclient/uploadClientSignContract', formDate)


/**
 * 查看合同原件
 */

export const getOriginFile = orderNo => get("weChatApi/fgclient/getOriginFile", {
	orderNo
})

/**
 * 获取出库磅单数据
 */

export const getOutPoundList = orderNo => get("weChatApi/fgclient/getOutPoundList", {
	orderNo
})


/**
 * 获取收货磅单数据
 */

export const getPoundList = (clientId, orderNo) => get("weChatApi/fgclient/getPoundList", {
	clientId,
	orderNo
})


/**
 * 过磅单详情
 */

export const viewPoundList = (carNo, orderNo) => get("weChatApi/fgclient/viewPoundList", {
	carNo,
	orderNo
})


/**
 * 确认过磅单重量
 */

export const confirmPound = (clientId, carNo, orderNo) => get("weChatApi/fgclient/confirmPound", {
	clientId,
	carNo,
	orderNo
})


/**
 * 查看过磅单图片
 */

export const getPoundPic = (carNo, orderNo, carId) => get("weChatApi/fgclient/getPoundPic", {
	carNo,
	orderNo,
	carId
})


/**
 * 确认运输完毕查询
 */

export const getTranOver = orderNo => get("weChatApi/fgclient/getTranOver", {
	orderNo
})


/**
 * 确认运输完毕点击未运完
 */

export const cancelTransOver = orderNo => get("weChatApi/fgclient/cancelTransOver", {
	orderNo
})


/**
 * 确认运输完毕点击已运完
 */

export const confirmTransOver = order => get("weChatApi/fgclient/confirmTransOver", {
	orderNo
})


/**
 * 签名确认
 */

export const ImgSignature = (orderNo,carNo,imgSignature) =>post("weChatApi/fgclient/confirmPound",{
  orderNo,
  carNo,
  imgSignature
})

/**
 * 获取入库单图片
 */
export const getStorePic = orderNo => get("weChatApi/fgclient/getStorePic", {
	orderNo
})


/**
 * 入库单确认
 */
export const confirmInStore = orderNo => get("weChatApi/fgclient/confirmInStore", {
	orderNo
})


/**
 * 查看银行回单
 */

export const getBankFallbackOrder = orderNo => get("weChatApi/fgclient/getBankFallbackOrder", {
	orderNo
})


/**
 * 运输车订单
 */

export const getTransInfoList = (clientId, orderNo) => get("weChatApi/fgclient/getTransInfoList", {
	clientId,
	orderNo
})


/**
 * 查看运输车信息
 */

export const getTransInfo = (carNo, orderNo) => get("weChatApi/fgclient/getTransInfo", {
	carNo,
	orderNo
})


/**
 * 通过订单号查询物料列表
 */

export const getGoodsNameList = orderNo => get('weChatApi/fgclient/getGoodsNameList', {
	orderNo
})


/**
 * 查询订单列表
 */

export const getOrderNoList = clientId => get('weChatApi/fgclient/getOrderNoList', {
	clientId
})


/**
 * 添加物料第一个页面
 */

export const getOrderMaterialList = orderNo => get('api/order/getOrderMaterialList', {
	orderNo
})


/**
 * 查询物料列表
 */

export const getTopMaterialList = (orderNo, clientId) => get('api/material/getTopMaterialList', {
	orderNo,
	clientId
})


/**
 * 查询物料的下一级
 */

export const getNextMaterialList = materialNo => get('api/material/getNextMaterialList', {
	materialNo
})


/**
 * 查含税物料
 */

export const getGroupMaterialList = materialNo => get('api/material/getGroupMaterialList', {
	materialNo
})


/**
 * 添加订单提交
 */

export const addOrEditMaterial = (clientId, orderNo, materialNo, counts, unitPrice, fixNo, fixPercent, zizhiPercent) =>
	get('api/order/addOrEditMaterial', {
		clientId,
		orderNo,
		materialNo,
		counts,
		unitPrice,
		fixNo,
		fixPercent,
		zizhiPercent
	})


/**
 * 待提交订单上传照片
 */

export const uploadOrderImg = formDate => formData('api/order/uploadOrderImg', formDate)


/**
 * 获取订单图片
 */

export const getOrderImg = orderNo => get('api/order/getOrderImg', {
	orderNo
})


/**
 * 删除订单图片
 */

export const deleteOrderImg = imagePath => get('api/order/deleteOrderImg', {
	imagePath
})


/**
 * 提交订单
 */

export const addOrEditOrder = (id, remarks) => get('api/order/addOrEditOrder', {
	id,
	remarks
})


/**
 * 沐桐过磅信息
 */

export const getMteGuobangInfo = carId => get('weChatApi/fgclient/getMteGuobangInfo', {
	carId
})


/**
 * 质检单信息
 */

export const getMteZhiJianInfo = carId => get('weChatApi/fgclient/getMteZhiJianInfo', {
	carId
})


/**
 * 用户信息查看
 */

export const getClientInfo = username => get('weChatApi/fgclient/getClientInfo', {
	username
})


/**
 * 注册页面查询供应商所有区域
 */

export const getAllAreaOne = () => get('api/client/getAllAreaOne')


/**
 * 注册页面查询省对应的市
 */

export const getAllProvince = province => get('api/client/getAllProvince', {
	province
})


/**
 * 注册页面下一步
 */

export const addOrEditClient = (clientName, clientAddress, addresIds, clientAreaId, clientType, province,
	clientPapersType, clientPhone, clientContactName, clientContactMobile, scopeBussinessId, scopeBussinessName,
	clientContactEmail, remarks) => get('api/client/addOrEditClient', {
	clientName,
	clientAddress,
	addresIds,
	clientAreaId,
	clientType,
	province,
	clientPapersType,
	clientPhone,
	clientContactName,
	clientContactMobile,
	scopeBussinessId,
	scopeBussinessName,
	clientContactEmail,
	remarks
})


export const getFgCategoryList = () => get('api/order/getFgCategoryList')

/**
 * 查询订单物料
 */

export const getOrderFixMaterialList = id => get('api/order/getOrderFixMaterialList', {
	id
})


/**
 * 修改物料
 */

export const addOrEditMaterialChange = (id, orderNo, materialNo, counts, fixNo, fixId, fixPercent, unitPrice,
		zizhiPercent) =>
	get('api/order/addOrEditMaterial', {
		id,
		orderNo,
		materialNo,
		counts,
		fixNo,
		fixId,
		fixPercent,
		unitPrice,
		zizhiPercent
	})

/**
 * 删除物料
 */

export const deleteMaterial = (id, orderNo) => get('api/order/deleteMaterial', {
	id,
	orderNo
})
